import loading from '../components/Loading.vue'

export function loadable(asyncFun) {
  const component = () => ({
    component: asyncFun(),
    loading
  })

  return {
    render(h) {
      return h(component)
    }
  }
}